#include <bits/stdc++.h>

using namespace std;

void Sort(int *a, int p, int q) {
//递归终点
    if (p >= q)return;
//递归体
    for (int j = p; j <= q - 1; j++) {
        if (a[j] > a[j + 1]) {
            swap(a[j], a[j + 1]);
        }
    }
//a[q] is max of range[p,q]
    Sort(a, p, q - 1);
}

int main() {
    int a[] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0};
    int n = sizeof(a) / sizeof(a[0]);
    //sort(a,a+n);
    Sort(a, 0, n - 1); //Sort a from 0(inclusive) to n-1(inclusive)
    for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
    }
    cout << endl;

    return 0;
}